﻿using System;
using System.Collections.Generic;
using System.Configuration;

namespace PSAMMatrixCloud.BLL.BizCommon
{
    /// <summary>
    /// 请求Model
    /// </summary>
    public class RequestModel
    {
        public RequestModel()
        {
            ParkingID = ConfigurationManager.AppSettings["ParkingID"];
            Version = "1.0";
            Timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
        }

        public string AppID { get; set; }//应用ID

        public string ParkingID { get; set; }//停车场ID

        public string MethodName { get; set; }//接口方法名

        public string Version { get; set; }//版本号

        public string Timestamp { get; set; }//时间戳，格式yyyyMMddHHmmss

        public string Sign { get; set; }//签名

        public string PostData { get; set; }

        public SortedDictionary<string, string> GetDictionary()
        {
            SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>();
            sParaTemp.Add("appid", AppID);
            sParaTemp.Add("parkingid", ParkingID);
            sParaTemp.Add("methodname", MethodName);
            sParaTemp.Add("version", Version);
            sParaTemp.Add("timestamp", Timestamp);
            sParaTemp.Add("postdata", PostData);

            return sParaTemp;
        }
    }

    public class ClientRequestModel
    {
        public ClientRequestModel()
        {
            ParkingID = ConfigurationManager.AppSettings["ParkingID"];
            Version = "1.0";
            Timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
        }

        public string AppID { get; set; }//应用ID

        public string ParkingID { get; set; }//停车场ID

        public string MethodName { get; set; }//接口方法名

        public string Version { get; set; }//版本号

        public string Timestamp { get; set; }//时间戳，格式yyyyMMddHHmmss

        public string Sign { get; set; }//签名

        public string PostData { get; set; }

        public string UserID { get; set; }

        public SortedDictionary<string, string> GetDictionary()
        {
            SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>();
            sParaTemp.Add("appid", AppID);
            sParaTemp.Add("parkingid", ParkingID);
            sParaTemp.Add("methodname", MethodName);
            sParaTemp.Add("version", Version);
            sParaTemp.Add("timestamp", Timestamp);
            sParaTemp.Add("postdata", PostData);
            sParaTemp.Add("userid", UserID);

            return sParaTemp;
        }
    }
}